﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Newtonsoft.Json;
using System.IO;

namespace GJLib
{
    public class OtherGenerator
    {
        public void staticMakeKM()
        {
            String [] Jis=GJR.地支();
            //六十甲子
            BigSixNineHelpVer2 bh2 = new BigSixNineHelpVer2();
            Dictionary<String, object> sixpan = new Dictionary<string, object>();
            for(int i=1;i<=60;i++)
            {
                String gj=GJR.六十甲子fromId(i);
                List<Dictionary<String, object>> pan12 = new List<Dictionary<string, object>>();
                sixpan.Add(gj, pan12);
                String 干 = GJR.pickFirstWord(gj);
                String startJi = GJR.天干寄宮(干);
                for (int j = 0; j < 12; j++)
                {
                    Dictionary<String, object> pp = new Dictionary<string, object>();
                    String seq="第"+(j+1)+"課";
                    pan12.Add(pp);
                    var pan=bh2.prepareby干上(gj, startJi);
                    pp.Add("序", seq);
                    pp.Add("干上", startJi);
                    pp.Add("空亡",pan.options["日空"]);
                    pp.Add("陷落",pan.options["陷落"]);
                    List<String> up=new List<string>();
                    foreach (String s in Jis)
                        up.Add(pan.取上神(s));
                    pp.Add("天盤", up);
                    startJi = GJR.nextJi(startJi);                    
                }
            }
            String content=JsonConvert.SerializeObject(sixpan, Formatting.Indented);
            File.WriteAllText(@"d:\3.txt", content);
        }
    }
}
